In copying a thick document on a copying apparatus, the document cover can not be closed tight and the copying apparatus is started with the document left open in what is called the sky shot. In a sky shot, an image sensor provided in the copying apparatus reads the area not covered with a document on the document table, that is, the area outside the document contour as black image. Therefore, if the image read is printed by printer or the like, the area around the document contour are printed black, which is undesirable from the point of view of aesthetics and increased consumption of toner.
To address this problem, a copying apparatus is proposed in which the image sensor does not read the area outside the document contour as black image. For example, a copying apparatus described in Japanese unexamined patent application No. 7-23224 finds upper left point (x1, y1) of the document and lower right point (x2, y2) and detects the area defined by a rectangle of the document formed with the line between the upper left point and the lower right point as its diagonal and detects the area as document contour as shown in FIG. 18.
For detection of the upper left point and the lower right point, for example, the copying apparatus scans the document beginning with the top reading line α in FIG. 18 and acquires the density values of the scanned pixels. If the acquired density value of the pixel is larger than a specific threshold value, this pixel is taken as white pixel and if the value is smaller than the threshold value, the pixel is taken as black pixel.
Furthermore, the copying apparatus scans each reading line α and memorizes the first pixel found as white pixel in each reading line α (hereinafter referred to as rise point). And then if a pixel found as black pixel (hereinafter down point) is detected, the distance L between the rise point and the down point will be worked out.
The copying apparatus compares this distance L and a distance threshold value. In case the distance L is larger than the distance threshold value, the copying apparatus recognizes the rise point and the down point as probable edge point thought to be an edge point of the document on the reading line α.
Furthermore, in case the probable edge points are recognized on the object reading line α and the adjacent reading lines α, the copying apparatus decides that the probable edge point recognized on the object reading line α are edge points of the document.
Of the edge points of the document thus obtained, two points are picked up. That is, the copying apparatus takes the value of the x coordinate (x1) of the extremely left edge point of the document, and the value of the x coordinate (x2) of the extremely right edge point of the document positioned. Also, the copying apparatus takes the value of the y coordinate (y1) at the rise point detected in the uppermost reading line α in FIG. 17 and the value of the y coordinate (y2) of the down point detected in the lowest reading line α.
Here, Y axis direction is the direction of main scanning and X axis direction is the direction of sub scanning. Furthermore, the left side is the upper side of the main scanning and right side is the lower side of the main scanning.
As set forth above, the copying apparatus detects the coordinates of the upper left point and the lower right point which are located at the ends of the diagonal of the rectangle and generates a rectangle surrounding the document and defines the document contour with the rectangle.
Then, from the image data read by main scanning, the copying apparatus erases the image outside the document contour on the basis of the document contour defined as described above.
However, the copying apparatus defines the document contour with the coordinates of 2 points as the ends of the diagonal of a rectangle document. In case the document is not a rectangle or the edges of the rectangular document are not placed along the main scanning direction (Y) and sub scanning direction (X), it can happen that there comes out an area within the rectangle where the document is not over lapped and the area will be read as black image by image sensor.
It is also noted that the above copying machine carries out pre-scan prior to the main-scanning the document. And it can happen that the user mistakes pre-scan for main scan and removes the document from the document table. If the document is removed before main scan begins, the image sensor can not read the document.
Furthermore, if a document is copied in a sky shot with the image of a fluorescent lamp in the ceiling projected on the document table, there is a possibility that the image sensor mistakenly detects the area projecting the image of the fluorescent lamp as white image. If the area mistakenly detected is outside the document, the copying apparatus detects a document contour larger than the actual document and leaves a black area in the document image area as shown in FIG. 19(a).
Another problem is that if one end portion of the area projecting the light is mistakenly detected as the document edge, part of the document contour is not perceived by the copying apparatus as shown in FIG. 19(b), and that part of the document image is cut off.